package com.kitty.game.npc.service.appreace;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.config.NPC;
import com.kitty.game.mirror.model.FightMirror;
import com.kitty.game.npc.message.RespNpcContent;
import com.kitty.game.role.message.RespAppear;
import com.kitty.game.role.message.RespUpdateAppearance;
import com.kitty.game.role.model.Role;
import org.springframework.stereotype.Component;

@Component
public class FightMirrorAppearanceHandler extends AppearanceHandler {
    @Override
    public void changeRespAppear(Role role, NPC npc, RespAppear respAppear) {
        SpringUtils.getMirrorService().changeRespAppear(npc, respAppear);
    }

    @Override
    public void changeRespUpdateAppearance(Role role, NPC npc, RespUpdateAppearance respUpdateAppearance) {
        SpringUtils.getMirrorService().changeRespUpdateAppearance(npc, respUpdateAppearance);
    }

    @Override
    public void changeRespNpcContent(Role role, NPC npc, RespNpcContent respNpcContent) {
        FightMirror fightMirror = SpringUtils.getMirrorService().getFightMirror(npc.getId());
        if (fightMirror != null) {
            respNpcContent.setNpcIcon(fightMirror.getRoleMirror().getIcon());
            respNpcContent.setNpcName(fightMirror.getRoleMirror().getName());
        }
    }
}
